package com.qdu.servlet;

import com.qdu.service.ActivCommentService;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * 在单个活动页面出现评论
 *
 * @author 19645
 */
@WebServlet("/pinglun")
public class ActiCommentServlet extends HttpServlet {

    ActivCommentService comment = new ActivCommentService();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        HttpSession session = req.getSession();

        String Uid = null;
        Uid = (String) session.getAttribute("PageUid");
        if (Uid == null) {
            resp.sendRedirect("Userlogin.html");
        } else {//获取用户id
            //获取评论内容
            String content = req.getParameter("content");
            String activityId = req.getParameter("activityId");
            //把这两个参数传过去，
            int row = comment.AddOneComment(activityId, Uid, content);
            resp.sendRedirect("gmis?activityId=" + activityId + "");
        }
    }

}
